1 Three Ways of Passing Data

1.1 CSV

# pass csv path as data argument
df <- repvisforODK::check_data_args(csv = "C:/Users/silblu/Documents/02-TIMCI-SPA-cgei.csv")
DT::datatable(head(df))

1.2 Data Frame

# load data from csv as data frame
df <- read.csv("C:/Users/silblu/Documents/02-TIMCI-SPA-cgei.csv", sep = ';')

# pass data frame as data argument
df <- repvisforODK::check_data_args(df = df)
DT::datatable(head(df))

1.3 ODK Central

# connect to ODK Central API
repvisforODK::setup_ruODK(svc = 'https://research.odk.path.org/v1/projects/4/forms/02-TIMCI-SPA-cgei.svc', un = 'lucas.silbernagel@swisstph.ch', tz = 'GMT', pw = Sys.getenv('ODKC_PW'))
## <ruODK settings>
##   Default ODK Central Project ID: 4 
##   Default ODK Central Form ID: 02-TIMCI-SPA-cgei 
##   Default ODK Central URL: https://research.odk.path.org 
##   Default ODK Central Username: lucas.silbernagel@swisstph.ch 
##   Default ODK Central Password: run ruODK::get_default_pw() to show 
##   Default ODK Central Passphrase: run ruODK::get_default_pp() to show 
##   Default Time Zone: GMT 
##   Default ODK Central Version: 1.1 
##   Default HTTP GET retries: 3 
##   Verbose messages: TRUE 
##   Test ODK Central Project ID:  
##   Test ODK Central Form ID:  
##   Test ODK Central Form ID (ZIP tests):  
##   Test ODK Central Form ID (Attachment tests):  
##   Test ODK Central Form ID (Parsing tests):  
##   Test ODK Central Form ID (WKT tests):  
##   Test ODK Central URL:  
##   Test ODK Central Username:  
##   Test ODK Central Password: run ruODK::get_test_pw() to show 
##   Test ODK Central Passphrase: run ruODK::get_test_pp() to show 
##   Test ODK Central Version: 1.1
# pass svc = TRUE as data argument
df <- repvisforODK::check_data_args(svc = TRUE)
DT::datatable(head(df))

2 Plot Examples

2.1 Received Submissions Over Time: Cumulative

fig <- repvisforODK::submissions_timeseries_lineplot(df = df, daily_submission_goal = 4, date_col = 'start', exclude_wday = c(1,7), cumulative = TRUE)

fig

Number of Submissions per Day Over Time


2.2 Distribution of Answers for Multiple-Choice Questions

plots <- repvisforODK::multiple_choice_question_bar(svc = TRUE, choice_col = 'choices_english_(en)', label_col = 'label_english_(en)')

htmltools::tagList(plots)

c2) Can you explain to me why this device was used?

h6) Were you given general information or advice about feeding or breastfeeding?

j6) What did you pay for?

3 Only Get New Data

3.1 Removing Submissions

# Removing 10 latest submissions
df_sliced <- df[10:nrow(df), ]

# printing removed submissions
DT::datatable(df[1:10, ])

3.2 Downloading Only Removed Submissions

new_data_df <- get_new_submissions_odata(df = df_sliced, id_col = 'id', submission_date_col = 'system_submission_date', merge_data = FALSE)
DT::datatable(new_data_df)